home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / gle / b.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-11-29  |  3.2 KB  |  265 lines

  1. #include <stdio.h>
  2. #include <cursesX.h>
  3. #include <signal.h>
  4. #include "vaxconio.h"
  5. #define false 0
  6. #define true (!false)
  7. #define dbg if (1==1)
  8. int noscreenio;
  9. main()
  10. {
  11.     scr_init();
  12. }
  13. delay(int i)
  14. {}
  15. int vx_top=1,vx_bot=24;
  16. textattr()
  17. {}
  18. abort_key()
  19. {
  20.     return false;
  21. }
  22. kbhit()
  23. {
  24.     return false;
  25. }
  26. scr_gets(char *x)
  27. {
  28.     getstr(x);
  29. }
  30. clreol()
  31. {
  32.     if (noscreenio) return;
  33.     clrtoeol();
  34. }
  35. cputs(char *line)
  36. {
  37.     int x;
  38.     int y;
  39.     if (noscreenio) return;
  40.     getyx(stdscr,y,x);
  41.     mvaddstr(y,x,line);
  42. }
  43. delline()
  44. {
  45.     int x;
  46.     int y;
  47.     getyx(stdscr,y,x);
  48.     move(22,1);
  49.     clrtobot();
  50.     move(y,1);
  51.     deleteln();
  52.     move(y,x);
  53. }
  54. gotoxy(int x, int y)
  55. {
  56.     if (noscreenio) return;
  57.     if (y==25) y=24;
  58.     move(y+vx_top-2,x);
  59. }
  60. insline()
  61. {
  62.     int x;
  63.     int y;
  64.     getyx(stdscr,y,x);
  65.     move(y,x);
  66.     insertln();
  67.     move(y,x);
  68.     move(22,1);
  69.     clrtobot();
  70.     move(y,x);
  71.  
  72. }
  73. putch(int char_val)
  74. {
  75.     int x;
  76.     int y;
  77.     getyx(stdscr,y,x);
  78.     mvaddch(y,x,char_val);
  79. }
  80. int scr_refresh()
  81. {
  82.     if (!noscreenio) refresh();
  83. }
  84. int scr_getch()
  85. {
  86.     if (noscreenio) return getc(stdin);
  87.     else return getch();
  88. }
  89. trap(int sig)
  90. {
  91.     echo();
  92.     nl();
  93.     nocbreak();
  94.     endwin();
  95.     exit(sig);
  96. }
  97. scr_init()
  98. {
  99. #ifdef unix
  100.     signal(SIGINT,trap);
  101. #endif
  102.     initscr();
  103.     scrollok(stdscr,true);
  104. #ifdef unix
  105.     noecho();
  106.     nonl();
  107.     cbreak();
  108.     clear();
  109.     keypad(stdscr,TRUE);
  110.     for (;;) {printw("%d ",getch()); refresh();}
  111. #endif
  112. }
  113. scr_end()
  114. {
  115.     if (noscreenio) return;
  116.     echo();
  117.     nl();
  118.     nocbreak();
  119.     endwin();
  120. }
  121. textbackground(int color_num)
  122. {}
  123. textcolor(int colornum)
  124. {}
  125. gettextinfo(struct text_info *r)
  126. {
  127.     int x;
  128.     int y;
  129.     if (noscreenio) return;
  130.     getyx(stdscr,y,x);
  131.     r->curx = x;
  132.     r->cury = y;
  133.     r->wintop = vx_top;
  134. }
  135. screen_save()
  136. {}
  137. screen_restore()
  138. {
  139.     if (noscreenio) return;
  140.     scr_norm();
  141.     clrscr();
  142.     gotoxy(1,1);
  143.     cputs("\n");
  144. }
  145. int wyerr;
  146. w_message(char *s)
  147. {
  148.     wyerr++;
  149.     if (noscreenio) return;
  150.     scr_savexy();
  151.     gotoxy(1,wyerr);
  152.     clreol();
  153.     cputs(s);
  154.     scr_restorexy();
  155. }
  156. window(int left,int top, int right, int bottom)
  157. {
  158.     if (left==1 && top==1 && bottom==25) {
  159.     if (noscreenio) return;
  160. #ifndef unix
  161.         printf("\x1b[%d;%dr",1,24);
  162. #endif
  163.     }
  164.     vx_top = top;
  165.     vx_bot = bottom;
  166.     wyerr = 0;
  167. }
  168. clrscr()
  169. {
  170.     if (noscreenio) return;
  171.     if (vx_top==1 && vx_bot==25) {
  172.         clearok(stdscr,TRUE);
  173.         clear();
  174.         refresh();
  175.         clearok(stdscr,FALSE);
  176.         return;
  177.     }
  178.     clear();
  179. }
  180. scr_dots(int i)
  181. {
  182. }
  183. scr_left(int i)
  184. {
  185.     int y,x;
  186.     if (i<=0) return;
  187.     getyx(stdscr,y,x);
  188.     move(y,x-i);
  189. }
  190. scr_right(int i)
  191. {
  192.     int y,x;
  193.     if (i<=0) return;
  194.     getyx(stdscr,y,x);
  195.     move(y,x+i);
  196. }
  197. int vx_topsave,vx_botsave;
  198. int savex,savey;
  199. scr_savexy()
  200. {
  201.     if (noscreenio) return;
  202.     getyx(stdscr,savey,savex);
  203.     vx_topsave = vx_top;
  204.     vx_botsave = vx_bot;
  205.  
  206. }
  207. scr_restorexy()
  208. {
  209.     if (noscreenio) return;
  210.     move(savey,savex);
  211.     vx_top = vx_topsave;
  212.     vx_bot = vx_botsave;
  213. }
  214.  
  215. scr_norm()  /* yellow on blue */
  216. {
  217. #ifndef unix
  218.     clrattr(_BOLD | _REVERSE);
  219. #endif
  220. }
  221. scr_inv()   /* black on white */
  222. {
  223. #ifndef unix
  224.     clrattr(_REVERSE);
  225.     setattr(_BOLD);
  226. #endif
  227. }
  228. scr_grey()  /* black on grey */
  229. {
  230. #ifndef unix
  231.     clrattr(_BOLD);
  232.     setattr(_REVERSE);
  233. #endif
  234. }
  235. scr_isblackwhite()
  236. {
  237.     return true;
  238. }
  239. scr_menubg()
  240. {
  241.     scr_norm();
  242. }
  243. scr_menuval()
  244. {
  245.     scr_inv();
  246. }
  247. scr_menuhi()
  248. {
  249.     scr_grey();
  250. }
  251.  
  252. #ifndef unix
  253. #include <descrip.h>
  254. vax_edt(char *s)     /* call the vax EDT editor */
  255. {
  256.     $DESCRIPTOR(sdesc,"");
  257.     sdesc.dsc$a_pointer = s;
  258.     sdesc.dsc$w_length = strlen(s);
  259.     edt$edit(&sdesc,&sdesc);
  260. }
  261. #else
  262. vax_edt(char *s)
  263. {}
  264. #endif
  265.